<template>
	<SlotModal ref='slotModalRef' v-bind='slotModalConfig'>
		<n-form ref='formRef' v-bind='formConfig'
				:model='formData' :rules='formRules'>
			<n-grid :x-gap='24' :cols='2'>
				<n-form-item-grid-item span='2' label='字典序号' path='sort'>
					<n-input-number v-model:value='formData.sort as number'
									style='width:100%;' min='0' clearable/>
				</n-form-item-grid-item>
				<n-form-item-grid-item span='2' label='字典类型' path='dictTypeCode'>
					<n-input v-model:value='formData.dictTypeCode' style='width:100%;'
							 disabled clearable/>
				</n-form-item-grid-item>
				<n-form-item-grid-item span='2' label='字典名称' path='dictTypeName'>
					<n-input v-model:value='formData.dictTypeName' style='width:100%;' clearable/>
				</n-form-item-grid-item>
				<n-form-item-grid-item span='2' label='是否启用' path='status'>
					<n-switch v-model:value='formData.status'
							  size='large' :checked-value='true' :unchecked-value='false'>
						<template v-slot:checked>启用</template>
						<template v-slot:unchecked>禁用</template>
					</n-switch>
				</n-form-item-grid-item>
				<n-grid-item span='2' :show-feedback='false'>
					<n-flex justify='center' align='center'
							:wrap='false' inline style='width:100%;'>
						<n-button round secondary type='info'
								  @click='submitEvent'>
							提交
						</n-button>
						<n-button round secondary type='default'
								  @click='clearFormData'>
							重置
						</n-button>
					</n-flex>
				</n-grid-item>
			</n-grid>
		</n-form>
	</SlotModal>
</template>
<script lang='ts' setup>
import { defineAsyncComponent, onBeforeMount, onMounted } from 'vue';
import useLeftAddModalHooks from './hooks/left/editModal.ts';
// ----------------------------------------------------------------------
const SlotModal = defineAsyncComponent(() => import('@/components/customComponents/modal/SlotModal.vue'));
// ----------------------------------------------------------------------
const props = defineProps({
	reLoad : {
		type    : Function,
		require : true,
		default : null
	}
});
const {
		  slotModalConfig, formConfig,
		  slotModalRef, formRef,
		  formData, formRules,
		  showModal,
		  clearFormData, submitEvent
	  } = useLeftAddModalHooks(props, SlotModal);
onBeforeMount(() => {
});
onMounted(async () => {
});
// 导出方法
defineExpose({ showModal });
</script>